<%= simple_form_for @person, :html => {:multipart => true} do |f| %>
    <%= f.error_notification %>

    <%= f.input :firstname, :label => 'First Name' %>
    <%= f.input :lastname, :label => 'Last Name' %>
    <%= f.input :nickname, :label => 'Nickname' %>
    <%= f.input :gender, :as => :select, :collection => ['Female', 'Male'] %>
    <%= f.input :date_of_birth, as: :string, placeholder: '1990-12-31',
                input_html: { size: 11,
                              value: format_date_value(f.object.date_of_birth) } %>
    <%= f.input :zipcode, :input_html => { :size => 10 } %>
    <%= f.input :city %>
    <%= f.input :state %>
    <%= f.input :status, :as => :select, :collection => Person::STATUS %>
    <%= f.input :end_date, as: :string,
                input_html: { class: 'datepicker', size: 11,
                              value: format_date_value(f.object.end_date) } %>

    <%= f.input :department_id, :collection => Department.managing_people.all,
                                :required => true %>

    <%= f.input :division1, :as => :grouped_select,
                            :group_method => :division1,
                            :label => 'Division',
                            :collection => Department.all %>
    <%= f.input :division2, :as => :grouped_select,
                            :group_method => :division2,
                            :label => 'Squad',
                            :collection => Department.all %>
    <%= f.input :application_date, as: :string,
                            input_html: { class: 'datepicker', size: 11,
                            value: format_date_value(f.object.application_date) } %>

      <h2> Phone information </h2>
      <div id="phones">
        <%= f.simple_fields_for :phones, wrapper: :horizontal_input_group do |phone| %>
          <%= render 'phones/phone_fields', phone: phone %>
        <% end %>
        <div class="links">
          <%= link_to_add_association 'Add phone', f, :phones, partial: 'phones/phone_fields', form_name: :phone,
          render_options: { wrapper: :horizontal_input_group } %>
        </div>
      </div>

      <h2> Email information </h2>
      <div id="emails">
        <%= f.simple_fields_for :emails, wrapper: :horizontal_input_group do |email| %>
          <%= render 'emails/email_fields', email: email %>
        <% end %>
        <div class="links">
          <%= link_to_add_association 'Add email', f, :emails, partial: 'emails/email_fields', form_name: :email,
          render_options: { wrapper: :horizontal_input_group } %>
        </div>
      </div>

    <%= f.input :icsid, label: 'ICS id', :input_html => { :size => 5 } %>
    <%= f.input :title, :as => :select, label: 'Rank', :collection => Person::TITLES, :required => false %>
    <%= f.association :titles %>
    <%= f.input :start_date, as: :string,
                input_html: { class: 'datepicker', size: 11,
                              value: format_date_value(f.object.start_date) } %>
    <h4> Personnel Image </h4>
    <%= @person.portrait %>
    <%= f.file_field :portrait %>
    <%= f.input :old_comments, :input_html => { :size => 40} %>
    <%= f.button :submit %>
<% end %>
